package com.taxi.comm.business.service.M004;

import java.io.IOException;
import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import com.taxi.comm.message.Request;




public class M004Request extends Request {

	public String QQPT;
	public String LXH;
	public String YCZL;
	public String YCLX;
	public String YCSJ;
	public String CKLXDH;
	public String SCDDWD;
	public String SCDDJD;
	public String SCDD;
	public String MPHM;
	public String KJLK;
	public String DBMC;
	public String MDD;
	public String BZ;


	public void init(String xml) throws Exception{
		
		StringReader sr = new StringReader(xml);
	
		InputSource is = new InputSource(sr);
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc = builder.parse(is);
		NodeList nl = doc.getElementsByTagName("SHCZ");
		
		Node node = nl.item(0);
		NamedNodeMap m1=node.getAttributes();
	    Node nodeAttri=m1.item(0);
	    System.out.println("node");
	    System.out.println(nodeAttri.getNodeValue());
	
		this.Ver=nodeAttri.getNodeValue();
		NodeList childNodes = node.getChildNodes();
		Node childNode = childNodes.item(0);
		NodeList childs = childNode.getChildNodes();
	
		for (int j = 0; j < childs.getLength(); j++) {

			Node child = childs.item(j);
			if (child.getNodeName().equals("BWLS")) {
				this.BWLS = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("BWLX")) {
				this.BWLX = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("QQBZ")) {
				this.QQBZ = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("YDDM")) {
				this.YDDM = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("FSF")) {
				this.FSF = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("JSF")) {
				this.JSF = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("SCSJ")) {
				this.SCSJ = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("BWXH")) {
				this.BWXH = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("XTMC")) {
				this.XTMC = child.getFirstChild().getNodeValue();
			
			}
            
			
		}
		childNode = childNodes.item(1);
		NodeList childs2 = childNode.getChildNodes();
		
		for (int k = 0; k < childs2.getLength(); k++) {

			Node child2 = childs2.item(k);
			
			if (child2.getNodeName().equals("QQPT")) {
				this.QQPT = child2.getFirstChild().getNodeValue();
			
			}
            if (child2.getNodeName().equals("LXH")) {
            	this.LXH = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("YCZL")) {
				this.YCZL = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("YCLX")) {
				this.YCLX = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("YCSJ")) {
				this.YCSJ = child2.getFirstChild().getNodeValue();
			
			}
					
			if (child2.getNodeName().equals("CKLXDH")) {
				this.CKLXDH = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("SCDDWD")) {
				this.SCDDWD = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("SCDDJD")) {
				this.SCDDJD = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("SCDD")) {
				this.SCDD = child2.getFirstChild().getNodeValue();
			
			}
			
			if (child2.getNodeName().equals("MPHM")) {
				this.MPHM = child2.getFirstChild().getNodeValue();
			
			}
			if (child2.getNodeName().equals("KJLK")) {
				this.KJLK = child2.getFirstChild().getNodeValue();
			
			}
			
			if (child2.getNodeName().equals("DBMC")) {
				this.DBMC = child2.getFirstChild().getNodeValue();
			
			}if (child2.getNodeName().equals("MDD")) {
				this.MDD = child2.getFirstChild().getNodeValue();
			
			}
			
			if (child2.getNodeName().equals("BZ")) {
				this.BZ = child2.getFirstChild().getNodeValue();
			
			}


		}
		
	}

}
